package com.oocl.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.oocl.dao.MerchantDao;
import com.oocl.dao.impl.MerchantDaoImpl;
import com.oocl.dto.MerchantDTO;
import com.oocl.pojo.Merchant;
import com.oocl.service.MerchantService;

/**
 * @description: 
 * @author  XIEMI2
 * @date Jul 28, 2017 8:53:40 PM
 * @version 1.0
 */
public class MerchantServiceImpl implements MerchantService{

	private MerchantDao merchantDao;
	
	public MerchantServiceImpl() {
		merchantDao = new MerchantDaoImpl();
	}



	@Override
	public List<Merchant> getMerchants(List<MerchantDTO> dtos) {
		List<Merchant> merchants = new ArrayList<Merchant>();
		for(MerchantDTO dto:dtos){
			Merchant m = merchantDao.findByName(dto.getUname());
			merchants.add(m);
		}
		return merchants;
	}


	@Override
	public Merchant findByName(String uname) {
		return merchantDao.findByName(uname);
	}

}


